package dhy.com.clawer;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;

import static dhy.com.clawer.ClawerProperties.PREFIX;

//爬虫配置:忽略不合法属性和多余属性
@ConfigurationProperties(prefix = PREFIX,ignoreInvalidFields = true,ignoreUnknownFields = true)
public class ClawerProperties
{
   public static final String PREFIX="clawer.file";
   private String window;
   private String linux;

   @ConstructorBinding
   public ClawerProperties(String window, String linux) {
      this.window = window;
      this.linux = linux;
   }

   //判断当前系统类型，决定文件路径
   public String getFilePathPrefix()
   {
      return System.getProperty("os.name").contains("Windows")?window:linux;
   }
}
